package wibrst.visual.dialog {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	/**
	 * ...
	 * @author ...
	 */
	public class VPromptPure extends Sprite {
		
		static public const EVT_CLOSE:String = "EVT_CLOSE";
		
		public function VPromptPure() {
			
		}
		
		/// auto close
		public function setAutoCloseDur( nSec:Number ):void {
			this._nSecAutoClose = nSec;
			
			this._timerAutoClose = new Timer( nSec, 1 );
			this._timerAutoClose.removeEventListener( TimerEvent.TIMER_COMPLETE, timerCompHandler );
			this._timerAutoClose.addEventListener( TimerEvent.TIMER_COMPLETE, timerCompHandler );
		}
		
		public function show():void {
			this.visible = true;
			if( _timerAutoClose ) _timerAutoClose.start();
		}
		
		private function timerCompHandler( evt:TimerEvent ):void {
			super.dispatchEvent( new Event( EVT_CLOSE ) );
		}
		
		/// auto close
		private var _nSecAutoClose:Number;
		private var _timerAutoClose:Timer;
		
	}

}